package com.igeek.collateral.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.igeek.collateral.entity.Agency;
import com.igeek.collateral.entity.Assess;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 * 评估机构 Mapper 接口
 * </p>
 *
 * @author author
 * @since 2024-07-04
 */
public interface AgencyMapper extends BaseMapper<Agency> {
    @Select("select * from agency where id=#{id}")
    @Results({
            @Result(id = true , column = "id" , property = "id"),
            @Result(column = "id" , property = "assessList" , javaType = List.class ,
                    many = @Many(select = "com.igeek.collateral.mapper.AssessMapper.selectByAgencyId"))
    })
  public Agency selectAll(Long id);
    @Delete("delete  from agency where id=#{id}")
    @Results({
            @Result(id = true , column = "id" , property = "id"),
            @Result(column = "id" , property = "assessList" , javaType = List.class ,
                    many = @Many(select = "com.igeek.collateral.mapper.AssessMapper.deleteByAgencyId"))
    })
     boolean deleteAll(Long id);



}
